package com.example.myapplication

import android.content.Context
import android.util.TypedValue
import kotlin.math.roundToInt

/**
 * Create by Tanzhenxing on 2025/10/24.
 * Description:
 */
fun Float.dp(context: Context) = TypedValue.applyDimension(
    TypedValue.COMPLEX_UNIT_DIP,
    this,
    context.resources.displayMetrics
).roundToInt()

fun Float.dpf(context: Context) = TypedValue.applyDimension(
    TypedValue.COMPLEX_UNIT_DIP,
    this,
    context.resources.displayMetrics
)

fun getScreenWidth(context: Context) = context.resources.displayMetrics.widthPixels